package com.ruoyi.purchase.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.purchase.domain.Firm;
import com.ruoyi.purchase.mapper.FirmMapper;
import com.ruoyi.purchase.service.FirmService;
import com.ruoyi.system.domain.SysCity;
import com.ruoyi.system.domain.SysProvince;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 */
@Service
public class FirmServiceImpl extends ServiceImpl<FirmMapper, Firm>
    implements FirmService{
    @Autowired
    private FirmMapper firmMapper;

    @Override
    public List<Firm> queryList(Firm firm) {
//        QueryWrapper<Firm> queryWrapper = Wrappers.query();
//        if (StringUtils.isNotEmpty(firm.getFirmName()))
//        {
//            queryWrapper.eq("firm_name", firm.getFirmName());
//        }
//        if (StringUtils.isNotEmpty(firm.getFirmChargeUser()))
//        {
//            queryWrapper.eq("firm_charge_user", firm.getFirmChargeUser());
//        }
//        if (StringUtils.isNotNull(firm.getSysCityId()))
//        {
//            queryWrapper.eq("sys_city_id", firm.getSysCityId());
//        }
//        if (StringUtils.isNotEmpty(firm.getStatus()))
//        {
//            queryWrapper.eq("status", firm.getStatus());
//        }
        return firmMapper.findAllFirm(firm);
    }

    @Override
    public List<SysCity> selectCityById(Integer cid) {
        return firmMapper.selectCityById(cid);
    }

    @Override
    public List<SysProvince> selectProv() {
        return firmMapper.selectProv();
    }


    @Override
    public int changeStatus(Firm firm) {
            return firmMapper.updateUser(firm);
    }

    @Override
    public Firm selectFirmById(Integer firmId) {
        return firmMapper.selectFirmById(firmId);
    }
}




